<?php
/**
 * CreateTime: 2023/7/14 16:10
 */

namespace App\Http\Requests\Customer;

use App\Http\Requests\BaseRequests;

class CustomerAdminCreatedRequest  extends BaseRequests
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'customer_name' => "required",
            'customer_type' => "required|in:1,2",
            'customer_phone' => "required|regex:/^1[3456789]\d{9}$/",
            'customer_account' => "required",
            'customer_login_password' => "required",
        ];
    }

    public function messages()
    {
        return [
            'customer_name.required' => "客户名称不能为空",
            'customer_type.required' => "客户类型不能为空",
            'customer_type.in' => "客户类型错误",
            'customer_phone.required' => "客户手机号不能为空",
            'customer_phone.regex' => "客户手机号格式错误",
            'customer_account.required' => "客户账号不能为空",
            'customer_login_password.required' => "客户密码不能为空",
        ];
    }
}